Changes from Version 5.0. This is important for those who are upgrading and have existing macros. Very few changes were made which could affect your existing macros. Here is a short list.
The formatting commands for formatting numbers in the programming dialect included some non-ANSI standard designations. These no longer work, and in fact will disable any macro that uses them. For example the letter “f” (for Float) used to be allowed in DOUBLE formats. It no longer is allowed. If any macros which use formatting statements (such as DOUBLE = %5.3l or LONG = etc.) do not work, check the formatting statements, they could be the cause.
The Find/Replace commands will now automatically open a header/footer or footnote window if the searched text pattern is found there. This could make existing macros not function properly as the header/footer or footnote window is not automatically closed after the search or replace. You should examine the function of the macro to determine how to handle any changes to correct for the effects of this added feature.
If any of your macros choose menu commands using the “menu name : menu item number” method, rather than just the menu item name, you may need to modify them because several menu items have changed positions, and new menu names have been created.
If you have named your menu commands using any of the new Nisus Writer menu command names, you should change their names to avoid disabling access from a macro, to either the new menu name or your macro command. In trying to debug any old macro problems, do not forget the special menu commands on the Find & Replace window, the names of the files in your “Last Used Files” list, and the names of any open windows in the windows menu. If your macro command names collide with any of these, you may experience problems.
Macros are used for automating repetitive tasks or customizing and creating new features. This folder includes a large selection of macros that you can either use as is or modify to suit your needs. To jump to any section listed in the contents below, click on the contents listing to select it, then choose the menu command To Reference Mark, from the Jump submenu from the Tools menu.
Below is a description of each of the macros shipped with Nisus Writer. All the files, except the “Nisus Macros” file, are in the “Example Macros” folder. The “Nisus Macros” file is in your “Nisus Writer Tools” folder, in the “Macros” folder. Any macro files you want to load automatically you should place there.
Macro Files Page
Apple Event & Frontier Macros
Calculation Macros
Editing Macros
File & Folder Macros
Find Expression Macros
Mailing List Macros
Metric & US Conversion Macros
Writer’s Macros
Nisus Macros
Apple Event & Frontier Macros
These illustrate how Apple events can be sent to other applications using the Frontier system.
Get System Folder Size—locates your active System folder and displays the disk size of the System folder using Frontier events. Requires Frontier to be installed.
Open Memory Control Panel—opens the Memory control panel using Frontier events. Requires Frontier to be installed.
Send Easy Alarms Reminder—asks you for reminder information and sends the reminder to Easy Alarms using Frontier and AppleEvents. Requires Frontier and Easy Alarms to be installed. (Easy Alarms is produced by Nisus Software.)
Send Easy Alarms Script—asks you for an Easy Alarms script name to have Easy Alarms run and sends the information to Easy Alarms using Frontier and AppleEvents. Requires Frontier to be installed. (Easy Alarms is produced by Nisus Software.)
Show Clipboard in Finder—displays the Clipboard in the Finder using Frontier events. Requires Frontier to be installed.
Take a Screen Shot—takes a picture of the current display using Frontier events. Requires Frontier to be installed.
Calculation Macros
These perform various calculations, including evaluations of any arithmetic or trigonometric expression.
Constants-This macro sets up the various constants that may be needed by other macros. It needs to be run once after starting Nisus Writer. The constants it sets up are onHour, oneDay, and pi. Edit it to add other constants or remove ones you never use.
Evaluate Line—evaluates any mathematical expression typed as a line of text. It does not need a selection. Supports all elementary math functions. Places the result on a new line below the expression.
Evaluate Selection—evaluates any mathematical expression selected. Supports all elementary math functions. Places the result at the end of the selection.
• Assign Column 1—assigns the rectangular selection as column 1. Press Option to make a rectangular selection. Used in conjunction with Add, Divide, Multiply and Subtract macro commands below. Not useful on its own.
• Assign Column 2—assigns the rectangular selection as column 2. Press Option to make a rectangular selection. Used in conjunction with Add, Divide, Multiply and Subtract macro commands below. Not useful on its own.
• Add Columns 1 & 2—adds column 1 and column 2, assigned by Assign Column 1 and Assign Column 2 macro commands above, and places the result to the right of column 2.
• Sum a Column—This macro assumes you have created a stack (col1) and it adds the elements together storing the result in clipboard 9. Its purpose is to illustrate the process and let you use it as part of your own macros.
Editing Macros
A sizeable list of macros useful in editing documents. Some are useful for illustration purposes or as building blocks for more complex macros.
Any Any Any—applies the attributes Any Font, Any Size, +Any Styles, and Any Language to the selected text.
Capitalize Sentences—capitalizes the beginning of each sentence in a selection. If there is no selection, this affects the whole document.
Clear Current Clipboard—clears the current Clipboard.
Copy Noncontiguous—Allows you to place a delimiter, like a space, tab, or return, between noncontiguous selections copied to the Clipboard.
End of Sentence—moves the insertion point to the end of the current sentence.
Lower Subscripts—changes all digits which follow an alphabetic within the selection to the Subscript style.
Number Bullets—converts all bullets “•” at beginning of paragraphs in the selection to sequential numbers. If there is no selection, this affects the whole document. There is another macro called “Autonumber •” (in the Nisus Macros file, inside the Nisus Writer Tools folder) which replaces the bullets at the beginning of paragraphs by the “Custom A” auto-counting variable.
Plain Numbers—changes all digits which follow an alphabetic within the selection to the Plain style. This reverses the “Lower Subscripts” and the “Raise Powers” macros.
Quote Me—encloses the current selection(s) in smart quotes.
Raise Powers—changes all digits which follow an alphabetic within the selection to the Superscript style. Useful for simple math expressions.
Remove Empty Paragraphs—deletes any extra return characters, taking care not to remove any such paragraphs that contain a ruler, as this would probably change the formatting of the text.
Remove Keep on Same Page—removes any Keep On Same Page attribute from all text in the document.
Remove Page Breaks—removes all forced page breaks in the document.
Remove Repeated Paragraphs—removes duplicates of repeated paragraphs in the current document.
Remove Trailing Blanks—removes all spaces and tabs at the ends of paragraphs.
Renumber—renumbers all numbers in a selection, starting with 1. If there is no selection, this affects the whole document.
Renumber From…—Same as Renumber, but allows you to choose the starting number.
Renumber Paragraphs—renumbers those paragraphs which already begin with a number. The starting number is the first one it finds after the insertion point.
Smart Quotes—replaces all quotes and single quotes with smart quotes, unless they refer to measures as in feet or inches.
Straight Quotes—replaces all smart quotes and single smart quotes with straight quotes and single straight quotes, respectively.
Unbreak E-mail Lines—removes all blanks at the beginnings of paragraphs and then removes all returns which are not preceded by a return, an end of sentence, or a colon. This seems to work well in removing unnecessary returns from most e-mail messages.
Unhyphenate Proper Name—finds every capitalized word and removes it from Hyphenate from the Tools menu.
File & Folder Macros
These get you the path to the current file and other paths.
Copy Open Pathnames—copies the full pathnames of all open documents to the Clipboard.
Copy Pathname—copies full pathname of current document to the Clipboard.
Copy Paths of Keyword File—This macro prompts the user for a key word or phrase and then looks through the search list (which must first be setup) files for that word or phrase. If a file containing the word or phrase is found, its pathname is appended onto the clipboard and the search continues. Closed files that are searched are not opened. The search list is not preserved.
Copy Search List Pathnames—places the full pathnames of all the files on the Search List in the Catalog on the current Clipboard.
Diagram Folder Structure—creates a hierarchical listing of all folders names from the current folder displayed in the Catalog window.
Find Expression Macros
These find various text patterns such as addresses, phone numbers etc.
Find Address—finds an address.
Find ASCII Value—finds the ASCII value of the character selected in the front document by selecting the character in the Character Table.
Find Contents Selection—finds the next occurrence of text marked for the table of contents.
Find End of Sentence—moves the insertion point to the end of the current sentence.
Find Index Selection—finds the next occurrence of text marked for the index.
Find Keep on Same Line—finds text with Keep on Same Line attribute.
Find Keep on Same Page—finds text with Keep on Same Page attribute.
Find Next Wrapped Line—moves the insertion point to the beginning of the next wrapped line.
Find Phone Number—finds the next phone number.
Find Repeated Word—searches for repeated words and selects them.
Select First 2 Lines of ¶—selects the first two lines of the next paragraph (searching forward through the document).
Select Last 2 Lines of ¶—selects the last two lines of the previous paragraph (searching backward through the document).
Mailing List Macros
A few macros useful in converting mailing-list databases from one format into another.
• Address List…—This macro will copy a list of addresses from any file. The addresses must be in the following format:
Nisus Software, Inc.
107 South Cedros Avenue
Solana Beach, CA 92075
• Convert -> Data Base—converts paragraph separated fields into a database format. Each record is separated by a blank paragraph and each field is on a separate line. This macro merges all fields of a record by replacing the return characters with commas and each record will be on a separate line.
• Convert <- Data Base—converts from a database format to one where each field is on separate line. The database format assumes that each record is on one line and fields are separated by commas.
• Extract Phone List—extracts names and phone numbers from addresses arbitrarily placed in files. It is assumed that a blank line precedes the address and the first line of the address contains the name that corresponds to the phone number. The phone number itself can appear anywhere in the address on a line by itself. The addresses must be in the following format:
Nisus Software, Inc.
107 South Cedros Avenue
Solana Beach, CA 92075
USA
1-619-481-1477
• Extract References…—prompts the user for a key word or phrase and searches the current file for all references to that key phrase. The references are placed in a file with the name of “Ref <current time and date>”.
• Zip Code Order—orders a document of addresses by zip code. Each address must be on a separate paragraph (use soft returns to separate lines) with a 5 or 9 digit zip code at the very end. The addresses must be in the following format:
Nisus Software Inc.,107 South Cedros Ave.,Solana Beach,CA,92075
John Doe,100 Main Street,Small Town,CA,91033-1113
*The remaining macro commands in this macro file are not for direct use. These macro commands are used by the macros listed above.
Metric & US Conversion Macros
Simple conversion of units macros.
°C->°F—Converts selected temperature from Celsius to Fahrenheit.
°F->°C—Converts selected temperature from Fahrenheit to Celsius.
°F Table-Creates a table, in the active document, of ºF and corresponding ºC values in increments of 0.2ºF.
inches->cm—Converts the selected number of inches to centimeters.
kg->lbs—Converts the selected number of kilograms to pounds.
km->miles—Converts the selected number of kilometers to miles.
lbs->kg—Converts the selected number of pounds to kilograms.
miles->km—Converts the selected number of miles to kilometers.
Writer’s Macros
These few macros help you clean-up your document and perform some finishing functions like merging two indexes.
Cleanup Details—performs a number of final “clean up” tasks in the current document such as converting "straight quotes" to “smart quotes”, move punctuation inside quotes, format am and pm properly, etc.
Contents Clean-up—finds all returns and explicit page breaks marked to be included in the contents and unmarks them.
Create Calendar—creates a calendar for a given month and year.
Create Word List 1—creates a word list based on the current selection, removing all duplicate words and sorting the remaining words. Case is significant. If there is no selection, this affects the whole document. [This performs the same function as the menu command (on the Index submenu). It is a complex macro, fully commented, which you can modify to suit your purpose when the menu command is not exactly what you need.]
Index Clean-up—finds all returns and explicit page breaks marked to be included in the Index and unmarks them. Note that any Index As marking such characters will not be affected.
Mark “to be” Verbs—finds various forms of the verb “to be” in the current document and marks them in the define style “To Be Verb” of Strike Through, Invert and Red.
Mark “to be” Verbs Remove—removes the define style “To Be Verb” from the forms of the “to be” verbs and from the current document.
Merge Indexes—merges two indexes with no more than one level of subindex together. The top two windows should be the index windows, generated by Make Index… from the Index submenu of the Tools menu. The merged index replaces the second window’s contents.
Read Sentences—This macro will start at the insertion point and select a sentence at a time and read it. The sentence selection is as good as you can expect. It does not assume an end of sentence at a single capital letter abbreviation. However it is meant to break at semicolons. If you get a message “there was an error in searching” you need to quit Nisus Writer and assign it more memory.
Nisus Macros
This file will be loaded automatically because it is in your Nisus Writer Tools folder, in the Macros folder.
Auto Number • - This replaces every bullet at the beginning of the paragraph with the automatic counter “Custom A.” If there is no selection, it does this from the insertion point to the end of the document. The effect is that each bullet is replaced with a number in sequence, so that bulleted paragraphs become numbered paragraphs.
Auto Number ¶ - This macro replaces the beginning of each paragraph with the automatic counter “Custom A.” If there is no selection, it does this from the insertion point to the end of the document. The effect is that each paragraph becomes numbered.
Bullet List - This macro puts a bullet (•) and a tab at each paragraph start in the selected text or for all paragraphs from the insertion point through the end of document, if there is no selection. If a bullet already starts the paragraph, no bullet or tab will be inserted.
Command - The Command macro will execute automatically when you press command while double-clicking. It is designed to work automatically only if it’s in a file named Nisus Macros. Command-double-click to open any valid URL. This Macro will take any URL, and change it into the form that Nisus Writer 5.0 needs to activate Internet Config. Command-double-click anywhere in the URL, and it will be changed, and, if you have set Internet Config to recognize your helpers, it will automatically open the URL with that program. This will only work correctly if the URL is written correctly. The macro will not make corrections for URLs with incorrect syntax. Please note that built into Nisus Writer 5.1 you have the feature that takes you to the URL if you first select it and then Command-single click it. However, this macro allows you to command-double-click without the need to select.
CommandOption Disabled - This macro, when re-named to “CommandOption” (that is remove the “Disabled”) executes automatically whenever you double click while holding the Command and Option keys pressed. It is designed to execute automatically only if it’s in a file named Nisus Macros. This particular macro will put the HTML opening and closing tags around the text you select while double-clicking. You can replace the tags with anything else you want. For example, you could replace them with the smart quotes, or with parentheses.
InitInit - The InitInit macro will execute automatically when this macro file is loaded. If this macro file loads automatically at startup, then this macro will run at that time. It is designed to execute automatically only if it’s in a file named Nisus Macros. Currently this macro is empty; you can type in your own commands or copy the text of another macro and paste it in here.
InitiNew - The InitNew macro will execute automatically when either (i) a NEW file is opened; or (ii) a stationery document is opened. It is designed to execute automatically only if it’s in a file named Nisus Macros. Currently this macro is empty; you can type in your own commands or copy the text of another macro and paste it in here.
InitOpen - The InitOpen macro will execute automatically when an existing Nisus Writer document is opened. It is designed to execute automatically only if it’s in a file named Nisus Macros. Currently this macro is empty; you can type in your own commands or copy the text of another macro and paste it in here.
InitRevert - The InitRevert macro will execute automatically when you choose Revert to Saved from the File menu. It is designed to execute automatically only if it’s in a file named Nisus Macros. Currently this macro is empty; you can type in your own commands or copy the text of another macro and paste it in here.
Option - The Option macro will execute automatically when you press option while double-clicking. It is designed to execute automatically only if it’s in a file named Nisus Macros. Currently this macro is designed to allow you to create “hot links” in Nisus Writer documents. You do this my marking the text to be jumped to, with a marker whose name must be exactly the key word in the Nisus document from which the jump will occur. Then when this Option macro is loaded, double click on the key word while holding the Option key pressed, and you will be taken to the location of the marker. This macro copies the selection to the clipboard, and then jumps to the marker whose name is in the clipboard.
Widow & Orphan Control - This macro forces the first two and last two lines of paragraphs to stay on the same page. It does this by applying the formatting style “Keep On Same Page” to these lines.